Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RPC Subscription Support to the Client #154

Merged
merged 5 commits into from
Jun 12, 2024
Merged

Conversation

lmittmann
Copy link
Owner

This PR adds support for RPC subscription (resolves #38)

New API

// package w3:
func (c *Client) SubscribeCtx(ctx context.Context, s w3types.RPCSubscriber) (*rpc.ClientSubscription, error)
func (c *Client) Subscribe(s w3types.RPCSubscriber) (*rpc.ClientSubscription, error)

// package w3types:
type RPCSubscriber {
	CreateRequest() (namespace string, ch any, params []any, err error)
}

// package module/eth:
func NewHeads(ch chan<- *types.Header) w3types.RPCSubscriber
func PendingTransactions(ch chan<- *types.Transaction) w3types.RPCSubscriber
func NewLogs(ch chan<- *types.Log, q ethereum.FilterQuery) w3types.RPCSubscriber

Copy link

cloudflare-workers-and-pages bot commented Jun 12, 2024

Deploying w3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 55eafb7
Status: ✅  Deploy successful!
Preview URL: https://99cc621c.w3-7ji.pages.dev
Branch Preview URL: https://feat-subscription.w3-7ji.pages.dev

View logs

@lmittmann lmittmann merged commit 43b46de into main Jun 12, 2024
7 checks passed
@lmittmann lmittmann deleted the feat/subscription branch June 12, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Subscription
1 participant